/* * ATTENTION! This file is automatically created from several JavaScript files. * Find file path and name in the comments in the beginning of the each code block */ /* * FILE START: _shared/code/js/front_system.js */ if(typeof(DEBUG_BY_IP) == 'undefined'){ DEBUG_BY_IP = false; } function show_picture(script, src, alt, width, height) { if(src.indexOf('__gen=1|') > 0){ if((src.substring(0,7).toLowerCase()) == "http://" && (src.substring(0,8).toLowerCase() == "https://")){ script = src; }else if((script.substring(0,7).toLowerCase()) != "http://" && (script.substring(0,8).toLowerCase() != "https://")){ script = frontBaseHref + script; script = script + '?' + src; }else{ script = script + '?' + src; } }else{ script = src; } if(aMatches = script.match(/\.swf$/i)){ AMI.UI.MediaBox.open(decodeURIComponent(script), width, height); }else{ AMI.UI.MediaBox.open(decodeURIComponent(script)); } return; } function show_details(script) { if ( (script.substring(0,7).toLowerCase()) != "http://" && (script.substring(0,8).toLowerCase() != "https://" ) ){ script = frontBaseHref + script; } var w_width = 200; var w_height = 250; if (w_height > window.screen.availHeight) w_height = window.screen.availHeight; if (w_width > window.screen.availWidth) w_width = window.screen.availWidth; window.open(script, "pic", "resizable=yes, status=yes, scrollbars=yes, width=" + w_width + ", height=" + w_height); //return false; } function none(){ return false; } function isEmail(string) { // if (string.search(/^(\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+(;|,|$))+$/) != -1) if (string.search(/^(\w+[\w.-]*\@[A-Za-z0-9а-яёА-ЯЁ]+((\.|-+)[A-Za-z0-9а-яёА-ЯЁ]+)*\.[\-A-Za-z0-9а-яёА-ЯЁ]+(;|,|$))+$/) != -1) return true; else return false; } // // following functions will be deleted later // function collect_link(cform){ var vlink = ''; var first = 1; for(var i=0; i = 0); }, /** * @static */ ajaxCallback: function(status, content){ if(status == 1 && (cartStatusPos = content.indexOf(" cart="" updated'))="">= 0){ content = content.substr(cartStatusPos); amiSession.loadVariables(); var aVarNames = content.split('|'); amiCart.updateBlock(aVarNames[1], aVarNames[2]); var actionStatus = ''; for(i = 3; i 3 ? '|' : '') + aVarNames[i]; } if(typeof(onAddedToCartMessage) == 'function'){ onAddedToCartMessage(actionStatus); }else{ alert(actionStatus); } if(amiCart.isCheckout){ document.location = amiCart.resultURL.replace(/\?.*/, ''); }else if(!amiCart.useAJAX){ document.location.reload(); } } }, updateBlock: function(itemCountCookieName, totalCookieName){ var cartItemCount = amiSession.get(itemCountCookieName); if(document.getElementById('idEshopCartIsNotEmpty')){ document.getElementById('idEshopCartIsNotEmpty').style.display = (cartItemCount == '' || cartItemCount == 0 ? 'none' : 'block'); } if(document.getElementById('idEshopCartIsEmpty')){ document.getElementById('idEshopCartIsEmpty').style.display = (cartItemCount == '' || cartItemCount == 0 ? 'block' : 'none'); } if(cartItemCount != ''){ if(document.getElementById(itemCountCookieName)){ document.getElementById(itemCountCookieName).innerHTML = cartItemCount; } if(document.getElementById(totalCookieName)){ document.getElementById(totalCookieName).innerHTML = amiSession.get(totalCookieName); } if(document.getElementById('eshopCartEmpty')){ document.getElementById('eshopCartEmpty').style.display = (cartItemCount > 0 ? 'inline' : 'none'); } } if(typeof(onUpdateCartBlock) == 'function'){ // backward compatibility onUpdateCartBlock(cartItemCount, amiSession.get(totalCookieName)); }else if(typeof(this.onUpdateBlock) == 'function'){ this.onUpdateBlock(cartItemCount, amiSession.get(totalCookieName)); } } } /* backward compatibility { */ // @todo replace AddToCart by amiCart.add and delete this function function AddToCart(url, itemId, numPrice, wrongPriceMsg){ return amiCart.add(url, itemId, numPrice, wrongPriceMsg); } // @todo replace AddToCartProp by amiCart.addProp and delete this function function AddToCartProp(url, itemId, propId, numPrice){ return amiCart.addProp(url, itemId, propId, numPrice); } /* } backward compatibility */ /* ADVERTISING BLOCK */ var advCurTmStamp = new Date(); document.usedAdvData = ""; var isInnerHtmlSupported = -1; var shownAdvPlaces = ''; var shownAdvPlacesCnt = 0; var advReferrer = '' var advPlaceCnts = []; if(document.referrer) advReferrer = document.referrer; function processShownAdvPlaces(shownAdvPlaces){ counter = 0; pos = -1; res = ""; while((pos = shownAdvPlaces.indexOf(';', pos+1)) >= 0){ if((pos1 = shownAdvPlaces.indexOf(';', pos+1)) 0){ curAdvPlace = shownAdvPlaces.substr(pos+1, pos1-pos-1); if((cpos = curAdvPlace.indexOf('_')) >= 0){ counter = curAdvPlace.substr(cpos+1)-1; curAdvPlace = curAdvPlace.substr(0, cpos); } advPlaceCnts[curAdvPlace] = ++counter; res += ';'+curAdvPlace+"_"+counter; } } if(res.length > 0) res += ';'; return res; } function showAdvPlace(idPlace, viewURL){ if(isInnerHtmlSupported == -1){ if(document.body.innerHTML) isInnerHtmlSupported = 1; else isInnerHtmlSupported = 0; } // After the document is loaded (new scheme) if(isInnerHtmlSupported == 1){ shownAdvPlacesCnt ++; document.write(' '); shownAdvPlaces += (shownAdvPlaces == '' ? ';' : '')+idPlace+';'; // Old scheme - inline method }else{ if (!document.usedAdvData) document.usedAdvData = ''; rndseed = new String(Math.random()); rndseed = rndseed.substring(2,11); document.write (""); } } function showAdvBanner(id, content){ if(document.usedAdvData) document.usedAdvData += ','+id+','; else document.usedAdvData = ','+id+','; document.writeln(content); } function aLnkClick(lnkID){ var aLink = frontBaseHref+"aproc.php?action=lclick&id="+lnkID+"&page_url="+encodeURIComponent(document.location.href); advClick(aLink); } function advClick(clickURL){ rndseed = new String(Math.random()); rndseed = rndseed.substring(2,11); clickURL+="&rs="+advCurTmStamp.getTime()+rndseed; img = new Image(); img.src = clickURL; } var advPlacesContent = []; var fillAdvPlaceWatcher = []; function fillAdvPlace(idPlace, idCnt, placeContent){ if(advPlacesContent[idPlace+'_'+idCnt] == undefined) advPlacesContent[idPlace+'_'+idCnt] = placeContent; if(fillAdvPlaceWatcher[idPlace+'_'+idCnt] == undefined) fillAdvPlaceWatcher[idPlace+'_'+idCnt] = 0; if(document.getElementById && document.getElementById('advp_'+idPlace+'_'+idCnt) && document.getElementById('advp_'+idPlace+'_'+idCnt).innerHTML != undefined){ document.getElementById('advp_'+idPlace+'_'+idCnt).innerHTML = advPlacesContent[idPlace+'_'+idCnt]; }else{ fillAdvPlaceWatcher ++; if(fillAdvPlaceWatcher = this.length) { return; } return this.slice(start); } Array.prototype._splice = function(start, deleteCount) { if (start >= this.length) { return; } return this.slice(0, start-1).concat(this.slice(start + deleteCount)); } } function cloneArray(source) { var destination = []; for (var i = 0 ; i = 0) { alert(compareInComparisonAlready); return false; } if (mComparisonList.length && !confirm(compareAddSelected)) { return false; } if (compareProducts.length == compareMaxQuantity) { alert(compareMaxMessage); return false; } if (mComparisonList.indexOf(key) 0) { var datasetId = compareDatasetId; var _mComparisonList = cloneArray(mComparisonList); for (var i = 0, qty = _mComparisonList.length ; i = 0) { alert(compareInComparisonAlready); oCheckbox.checked = false; return false; } // check for max quantity of products to compare if (compareProducts.length == compareMaxQuantity) { alert(compareMaxMessage); oCheckbox.checked = false; return false; } // check for different datasets if (compareDisallowDifferentDatasets) { var p = key.split('-'); if ((compareProducts.length + mComparisonList.length) > 0 && p[2] != copmpareLastDatasetId && !confirm(compareConfirmOtherDataset)) { oCheckbox.checked = false; return false; } copmpareLastDatasetId = p[2]; // uncheck checked products having other dataset var _mComparisonList = cloneArray(mComparisonList); for (var i = 0, qty = _mComparisonList.length ; i = compareMaxQuantity) { alert(compareMaxMessage); oCheckbox.checked = false; return false; } } mComparisonList.push(key); } else { var index = mComparisonList.indexOf(key); if (index > -1) { if (Array.prototype.splice) { mComparisonList.splice(index, 1); } else { mComparisonList = mComparisonList._splice(index, 1); } copmpareLastDatasetId = compareDatasetId; } } } function mSubmitAddToCompare() { var qty = mComparisonList.length; if (!qty) { alert(compareListIsEmpty); return false; } var _mComparisonList = cloneArray(mComparisonList); // check for added already products and exclude its from mComparisonList for (var i = 0 ; i = 0) { // exclude duplicate product if (Array.prototype.splice) { mComparisonList.splice(_mComparisonList.indexOf(mComparisonList[i]), 1); } else { mComparisonList = mComparisonList._splice(_mComparisonList.indexOf(mComparisonList[i]), 1); } } } document.location = location.pathname + '?action=compare&products=' + _mComparisonList.join(';'); return false; } function mCompareSelected(url) { if (mComparisonList.length 1) { window.open(frontBaseHref + url + '?p=' + compareProducts.join(';') + '&h=&v=all&lay_id=100'); return false; } alert(compareListInsufficient); return false; } if (compareProducts.length && !confirm(compareConfirmPreviousClearing)) { return false; } window.open(frontBaseHref + url + '?p=' + mComparisonList.join(';') + '&h=&v=all&lay_id=100'); return false; } /* /products comparison */ function getXPos(elem){ x = 0; do { x += elem.offsetLeft; } while((elem = elem.offsetParent) != null); return x; } function getYPos(elem){ y = 0; do { y += elem.offsetTop; } while((elem = elem.offsetParent) != null); return y; } var calendarBlock; var calendarDateFieldName; function insertAfter(newChild, refChild) { refChild.parentNode.insertBefore(newChild,refChild.nextSibling); } function getCalendar(in_dateField, lang, dateFormat, divIdPrefix){ var elevPrefix = typeof(divIdPrefix) == 'undefined' ? '' : divIdPrefix; calendarTarget = in_dateField; calendarBlock = document.getElementById(elevPrefix + "calendar_block"); if(calendarBlock && (calendarBlock.style.display!="block" || (in_dateField.form.name + in_dateField.name!=calendarDateFieldName))){ calendarDateFieldName = in_dateField.form.name + in_dateField.name; var pos = AMI.Browser.getObjectPosition(calendarTarget, true); var cLeft = pos[0]; var cTop = pos[1]; var dconfAddon = ''; if(typeof(dateFormat) != 'undefined' && dateFormat != ''){ dconfAddon = '&date_format='+dateFormat; } document.getElementById(elevPrefix + "calendar_block_frm").src = "calendar.php?v=2&lang="+lang+dconfAddon; calendarBlock.style.position = 'absolute'; calendarBlock.style.display="block"; calendarBlock.parentNode = null; insertAfter(calendarBlock, calendarTarget); var correctLeft = calendarTarget.offsetWidth + 10; var correctTop = calendarTarget.offsetHeight; calendarBlock.style.left = (cLeft + correctLeft) + 'px'; calendarBlock.style.top = (cTop + correctTop) + 'px'; document.getElementById(elevPrefix + "calendar_block_frm").contentWindow.document.body.focus(); }else if(calendarBlock){ calendarBlock.style.display="none"; } } function replaceDateTitle(objId){ var objObj = document.getElementById(objId); if(objObj){ var curDate = objObj.innerHTML; var rxToday = new RegExp(DATE_CONVERTION[2].replace(/\./g, "\\.")); var rxYesterday = new RegExp(DATE_CONVERTION[3].replace(/\./g, "\\.")); curDate = curDate.replace(rxToday, DATE_CONVERTION[0]); curDate = curDate.replace(rxYesterday, DATE_CONVERTION[1]); objObj.innerHTML = curDate; } } /* Пример использования календаря

дата:
*/ function saveURLHistory(){ var uh_prev_mod = getCookie('uh_prev_mod'); var uh_prev_url = getCookie('uh_prev_url'); var uh_curr_mod = getCookie('uh_curr_mod'); var uh_curr_url = getCookie('uh_curr_url'); delCookie('uh_prev_mod', "/"); delCookie('uh_prev_url', "/"); delCookie('uh_curr_mod', "/"); delCookie('uh_curr_url', "/"); if(uh_curr_mod == null){ setCookie('uh_prev_mod', active_module, "/"); setCookie('uh_prev_url', active_module_link, "/"); setCookie('uh_curr_mod', active_module, "/"); setCookie('uh_curr_url', active_module_link, "/"); }else if(uh_curr_mod != active_module){ setCookie('uh_prev_mod', uh_curr_mod, "/"); setCookie('uh_prev_url', uh_curr_url, "/"); setCookie('uh_curr_mod', active_module, "/"); setCookie('uh_curr_url', active_module_link, "/"); }else{ setCookie('uh_prev_mod', uh_prev_mod, "/"); setCookie('uh_prev_url', uh_prev_url, "/"); setCookie('uh_curr_mod', active_module, "/"); setCookie('uh_curr_url', active_module_link, "/"); } } saveURLHistory(); function amiFrontCommonClass(){ this.serialize = function(oData){ var result = ''; if(typeof(oData) == "object"){ if(oData instanceof Array){ result += 'a'; for(var i = 0; i 1)){ for(var j=1; j "+">">=>